﻿{literal}
<script type="text/javascript">
function Forum_checkManagment( userId, postI ) {
	if( userId == loggedInUserId ) {
		document.getElementById("postManagment_"+postI).style.display = "";
	}
}
</script>
{/literal}

<div class="contentTitleDark">
	{$location}
</div>
<div class="contentTitleLightMain">
	<div class="redButton">
		<a href="{$pageUrl}Forum/managePost/{$posts.0.id}/addPost/" class="red s11 b">Vasta teemale! </a>
	</div>
	{$posts.0.title}
</div>

{if count($pages) > 0}
<div class="content">
<div class="pageNumbers">
{if $prevLink}<a href="{$prevLink}" style="width:50px">Eelmised</a>{/if}
{foreach item=i from=$pages}
	<a href="{$i.link}"  style="{if $i.selected}font-weight:bold{/if} ">{$i.name}</a>
{/foreach}
{if $nextLink}<a href="{$nextLink}" style="width:57px">Järgmised</a>{/if}
</div>
<div style="clear:both"></div>
</div>
{/if}

<div class="content">
	
	{foreach item=i key=k from=$posts}
	<div style="background-color:{cycle values='#FFFFFF,#EEEEEE'}">	
		
		
		<div style="width:120px; height: 160px; float:left; padding:2px;">
			{if $i.nickname != $i.username}
			<a href="{$pageUrl}User/profile/{$i.userId}" class="black s10 n">{$i.username}</a><br />
			{/if}
			<a href="{$pageUrl}User/profile/{$i.userId}" class="red s11 b">{$i.nickname}</a><br />
			{if $i.userIcon}<img src="{$uploadUrl}Users/{$i.userIcon}" border="0" style="float:left"/>{/if}
			<br style="clear:left;"/>
			
			Postitatud: {$i.date}<br />
			{if $i.userId}
			Postitusi: {$i.posts}<br />
			{if $i.userId != $loggedInUser->id}
			<img src="{$mediaUrl}mail_icon.jpg" style="padding-right: 3px;" align="absmiddle"> <a class="red" href="{$pageUrl}User/sendMail/{$i.userId}">Saada teade</a>
			{/if}
			{/if}
			
			{if $i.allowModify}  
			<div><br />
				<a href="{$pageUrl}Forum/managePost/{$i.id}/{if $k==0}topic{else}post{/if}" class="red s10 b">Muuda</a> 
				<a href="{$pageUrl}Forum/delete/{if $k==0}topic{else}post{/if}/{$i.id}"  class="red s10 b">Kustuta</a>
			</div>
			{/if}
		</div>
		
		
		<div class="forumPostRight">
			<h2>{$i.title}</h2>
			{$i.contents}<br /><br />
			
			<div class="gallery">
			{foreach item=s key=k from=$i.images}
				{if $k%5==0}<div style="clear:both"></div>{/if}
				<div class="galleryImage">
				<a href="{$uploadUrl}ForumImages/{$s.image}" rel="lightbox[]"><img src="{$uploadUrl}ForumImages/{$s.icon}" /></a><br />
				<i>{$s.title}</i>
				</div>
			{/foreach}
			</div>
			
			<div class="redButton" style="float:right; margin-right:8px;"><a href="{$pageUrl}Forum/managePost/{$posts.0.id}/addPost/{if $k==0}t{else}s{/if}{$i.id}" class="red s11 b">Tsiteeri </a></div>
		</div>
		
		<div style="clear:both; width: 100%; border-top: {if $k==0}3px double{else}1px dotted{/if} #CC0000"></div>
		
	</div>
	{/foreach}

</div>


{if count($pages) > 0}
<div class="content">
<div class="pageNumbers">
{if $prevLink}<a href="{$prevLink}" style="width:50px">Eelmised</a>{/if}
{foreach item=i from=$pages}
	<a href="{$i.link}"  style="{if $i.selected}font-weight:bold{/if} ">{$i.name}</a>
{/foreach}
{if $nextLink}<a href="{$nextLink}" style="width:57px">Järgmised</a>{/if}
</div>
<div style="clear:both"></div>
</div>
{/if}


<div class="contentTitleLightMain">
	<div class="redButton">
		<a href="{$pageUrl}Forum/managePost/{$posts.0.id}/addPost/" class="red s11 b">Vasta teemale! </a>
	</div>
</div>